package com.chixing.day04.test;

/**
 * @author Y2014188432
 */
public class Computer {
    private Mainboard mainboard;

    public Computer(Mainboard mainboard) {
        this.mainboard = mainboard;
    }

    public static void main(String[] args) {
        VideoCard dMeng = new DmengVideoCard();
        Cpu intel = new IntelCpu();
        Mainboard mainboard = new Mainboard(intel,dMeng);
        Computer computer = new Computer(mainboard);
        computer.openPC();
        computer.closePC();
    }

    /**
     * 打开电脑
     */
    public void openPC(){
        System.out.println("打开电脑");
        mainboard.run();
    }

    /**
     * 关闭电脑
     */
    public void closePC(){
        System.out.println("关闭电脑");
        mainboard.close();
    }
}
